-
Couldn't load subscription status.
- Fork 5.5k
Trengo - new components #18322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trengo - new components #18322
Conversation
WalkthroughAdds two new Trengo actions (list-tickets, list-messages), implements app method getMessages, and bumps versions and documentation wording across multiple Trengo actions and sources; package version moved to 0.3.0. No functional changes to existing logic beyond the new actions and the new app method. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant PD as Pipedream Action (List Tickets)
participant App as Trengo App
participant API as Trengo API
User->>PD: Invoke List Tickets (filters, sort, maxResults?)
PD->>App: app.getTickets(params)
App->>API: GET /tickets?...
API-->>App: Paged ticket results
loop Stream pages
App-->>PD: Tickets page
PD->>PD: Accumulate, enforce maxResults
end
PD-->>User: Tickets[] + $summary
sequenceDiagram
autonumber
actor User
participant PD as Pipedream Action (List Messages)
participant App as Trengo App
participant API as Trengo API
User->>PD: Invoke List Messages (ticketId, maxResults?)
PD->>App: app.getMessages({ ticketId })
App->>API: GET /tickets/{ticketId}/messages
API-->>App: Paged message results
loop Stream pages
App-->>PD: Messages page
PD->>PD: Accumulate, enforce maxResults
end
PD-->>User: Messages[] + $summary
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks (2 passed, 2 warnings, 1 inconclusive)❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs (1)
73-74: Fix incorrect summary text (copy/paste from contact create).The action sends a WhatsApp template, not a contact create; current summary may also reference non-existent fields.
Apply:
- $.export("$summary", `The contact has been created. (${resp.name} ID:${resp.id})`); + $.export("$summary", `WhatsApp template sent${this.ticketId ? ` for ticket ${this.ticketId}` : ""}${this.recepientPhoneNumber ? ` to ${this.recepientPhoneNumber}` : ""}.`);components/trengo/actions/send-a-message/send-a-message.mjs (1)
22-22: Fix typo in user-facing description.
Change “en email” → “an email” and add a comma after “Channel ID”.- description: "The destination of the message. Based on the `Channel ID` this must be en email address or phone number.", + description: "The destination of the message. Based on the `Channel ID`, this must be an email address or phone number.",components/trengo/sources/new-internal-note/new-internal-note.mjs (1)
19-20: Wrong summary text for this source.
Mentions “ticket label” instead of “internal note”.- summary: `New ticket label added event: ${event?.body?.message}`, + summary: `New internal note: ${event?.body?.message}`,
🧹 Nitpick comments (13)
components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs (1)
12-19: Optional: Standardize “recipient” spelling.Prop name uses “recepient…”. Consider aliasing/renaming across app/props to “recipientPhoneNumber” to avoid user confusion.
I can prep a follow-up PR adding a backward-compatible alias and deprecation note.
components/trengo/actions/find-contacts/find-contacts.mjs (1)
33-34: Correct singular/plural verb agreement in summary.Use “has” for 1, “have” otherwise.
- $.export("$summary", `${contacts.length} contact${contacts.length == 1 ? "" : "s"} have been found.`); + $.export("$summary", `${contacts.length} contact${contacts.length === 1 ? "" : "s"} ${contacts.length === 1 ? "has" : "have"} been found.`);components/trengo/sources/phone-call-missed/phone-call-missed.mjs (1)
6-6: Polish description grammar.- description: "Emit new events when an phone call missed. [See the docs here](https://developers.trengo.com/docs/webhooks)", + description: "Emit new events when a phone call is missed. [See the docs](https://developers.trengo.com/docs/webhooks)",components/trengo/sources/ticket-label-added/ticket-label-added.mjs (1)
6-6: Polish description grammar.- description: "Emit new events when a ticket label added. [See the docs here](https://developers.trengo.com/docs/webhooks)", + description: "Emit new events when a ticket label is added. [See the docs](https://developers.trengo.com/docs/webhooks)",components/trengo/sources/new-outbound-message/new-outbound-message.mjs (2)
6-6: Polish description grammar.- description: "Emit new events when an outbound message sent. [See the docs here](https://developers.trengo.com/docs/webhooks)", + description: "Emit new events when an outbound message is sent. [See the docs](https://developers.trengo.com/docs/webhooks)",
19-20: Fix typo in summary (“outbund”).- summary: `New outbund message event: ${event?.body?.message}`, + summary: `New outbound message event: ${event?.body?.message}`,components/trengo/sources/ticket-reopened/ticket-reopened.mjs (1)
15-17: Specify radix for parseInt.
Prevents locale/format surprises; prefer base 10.- const id = event?.body?.ticket_id ? - parseInt(event.body.ticket_id) : + const id = event?.body?.ticket_id ? + parseInt(event.body.ticket_id, 10) :components/trengo/actions/list-articles/list-articles.mjs (1)
26-35: Don’t restrict valid filter values to a fixed list.
Docs allowuntranslated_<language_code>. Current options block other languages.optional: true, - options: [ - "draft", - "published", - "untranslated_en", - ], + placeholder: "draft | published | untranslated_<language_code>",components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs (1)
13-18: Use a single timestamp for id and ts.
Avoids micro-mismatches from two Date.now() calls.methods: { ...common.methods, getMeta(event) { - return { - id: Date.now(), - ts: Date.now(), + const ts = Date.now(); + return { + id: ts, + ts, summary: `Voice call recorded: ${event?.body?.from} => ${event?.body?.to} (${event?.body?.duration}s)`, }; },Note: If the payload exposes a stable call ID (e.g.,
event.body.call_id), prefer that over a timestamp for dedupe.components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs (1)
44-49: Tighten validation and fix typo in error message.
Treat empty arrays as missing and correct “Attachement”.async run ({ $ }) { if (!this.threadId && !this.toUserId) { throw new ConfigurationError("Either `Thread ID` or `To User ID` should be set!"); } - if (!this.body && !this.attachmentIds) { - throw new ConfigurationError("Either `Body` or `Attachement IDs` should be set!"); + if (!this.body && (!this.attachmentIds || this.attachmentIds.length === 0)) { + throw new ConfigurationError("Either `Body` or `Attachment IDs` must be set!"); }components/trengo/sources/ticket-closed/ticket-closed.mjs (1)
15-17: Specify radix for parseInt.- const id = event?.body?.ticket_id ? - parseInt(event.body.ticket_id) : + const id = event?.body?.ticket_id ? + parseInt(event.body.ticket_id, 10) :components/trengo/sources/new-internal-note/new-internal-note.mjs (1)
15-17: Specify radix for parseInt.- id: event?.body?.message_id ? - parseInt(event?.body?.message_id) : + id: event?.body?.message_id ? + parseInt(event?.body?.message_id, 10) :components/trengo/sources/new-inbound-message/new-inbound-message.mjs (1)
15-17: Specify radix for parseInt.- id: event?.body?.message_id ? - parseInt(event?.body?.message_id) : + id: event?.body?.message_id ? + parseInt(event?.body?.message_id, 10) :
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
components/trengo/actions/create-contact/create-contact.mjs(1 hunks)components/trengo/actions/find-contacts/find-contacts.mjs(1 hunks)components/trengo/actions/list-articles/list-articles.mjs(1 hunks)components/trengo/actions/list-messages/list-messages.mjs(1 hunks)components/trengo/actions/list-tickets/list-tickets.mjs(1 hunks)components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs(1 hunks)components/trengo/actions/send-a-message/send-a-message.mjs(1 hunks)components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs(1 hunks)components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs(1 hunks)components/trengo/package.json(1 hunks)components/trengo/sources/new-inbound-message/new-inbound-message.mjs(1 hunks)components/trengo/sources/new-internal-note/new-internal-note.mjs(1 hunks)components/trengo/sources/new-outbound-message/new-outbound-message.mjs(1 hunks)components/trengo/sources/phone-call-ended/phone-call-ended.mjs(1 hunks)components/trengo/sources/phone-call-missed/phone-call-missed.mjs(1 hunks)components/trengo/sources/phone-call-started/phone-call-started.mjs(1 hunks)components/trengo/sources/ticket-closed/ticket-closed.mjs(1 hunks)components/trengo/sources/ticket-label-added/ticket-label-added.mjs(1 hunks)components/trengo/sources/ticket-reopened/ticket-reopened.mjs(1 hunks)components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs(1 hunks)components/trengo/trengo.app.mjs(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
components/trengo/actions/list-tickets/list-tickets.mjs (1)
components/trengo/actions/list-messages/list-messages.mjs (2)
resourcesStream(27-32)length(39-39)
components/trengo/actions/list-messages/list-messages.mjs (1)
components/trengo/actions/list-tickets/list-tickets.mjs (2)
resourcesStream(72-85)length(92-92)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Lint Code Base
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (24)
components/trengo/actions/create-contact/create-contact.mjs (1)
6-6: Version bump LGTM.No functional changes; safe to publish.
components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs (1)
7-7: Version bump LGTM.No behavior change.
components/trengo/package.json (1)
3-3: Package version bump LGTM.Matches new actions added in this release.
components/trengo/actions/find-contacts/find-contacts.mjs (2)
7-7: Version bump LGTM.
21-28: Generated new verification scripts to locate thegetResourcesStreamimplementation and inspect its import in thefind-contacts.mjsfile, to confirm whether the resource function is bound correctly.components/trengo/sources/phone-call-missed/phone-call-missed.mjs (1)
7-7: Version bump LGTM.components/trengo/sources/ticket-label-added/ticket-label-added.mjs (1)
7-7: Version bump LGTM.components/trengo/sources/new-outbound-message/new-outbound-message.mjs (1)
7-7: Version bump LGTM.components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs (1)
6-6: Version bump LGTM.components/trengo/actions/send-a-message/send-a-message.mjs (1)
6-6: LGTM: version bump only.components/trengo/sources/ticket-reopened/ticket-reopened.mjs (1)
7-7: LGTM: version bump only.components/trengo/actions/list-articles/list-articles.mjs (2)
7-7: LGTM: version bump only.
51-61: Ignore outdated review: nogetArticlesin this action (usesgetAllArticles).Likely an incorrect or invalid review comment.
components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs (1)
7-7: LGTM: version bump only.components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs (1)
7-7: LGTM: version bump only.components/trengo/sources/ticket-closed/ticket-closed.mjs (1)
7-7: LGTM: version bump only.components/trengo/sources/new-internal-note/new-internal-note.mjs (1)
7-7: LGTM: version bump only.components/trengo/sources/new-inbound-message/new-inbound-message.mjs (1)
7-7: LGTM: version bump only.components/trengo/sources/phone-call-started/phone-call-started.mjs (1)
7-7: Version bump looks goodNo functional changes; safe to publish.
components/trengo/sources/phone-call-ended/phone-call-ended.mjs (1)
7-7: Version bump looks goodNo functional changes; safe to publish.
components/trengo/actions/list-tickets/list-tickets.mjs (2)
71-85: LGTM on streaming + early exitThe resources stream pattern and maxResults cap are correct.
75-83: Yes—please extract and paste the “Try it” section’s parameter details for the List all tickets endpoint, including:
- Exact enum values and casing for
statusandlast_message_type- Format for
usersandchannels(array vs CSV)- Valid
sortvalues (datevs-date)components/trengo/trengo.app.mjs (1)
291-298: LGTM: adds messages endpoint wrapperSignature matches usage in the action; args are forwarded for pagination.
components/trengo/actions/list-messages/list-messages.mjs (1)
25-45: LGTM: streaming messages with maxResults and summarySolid implementation; aligns with existing patterns.
components/trengo/sources/new-inbound-message/new-inbound-message.mjs
Outdated
Show resolved
Hide resolved
components/trengo/sources/new-internal-note/new-internal-note.mjs
Outdated
Show resolved
Hide resolved
components/trengo/sources/phone-call-ended/phone-call-ended.mjs
Outdated
Show resolved
Hide resolved
components/trengo/sources/phone-call-started/phone-call-started.mjs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
components/trengo/actions/create-contact/create-contact.mjs (1)
40-41: Harden the summary against missing fields and improve readability.Use null-safe access and consistent formatting.
- $.export("$summary", `The contact has been created. (${resp.name} ID:${resp.id})`); + const name = resp?.name ?? "contact"; + const id = resp?.id ?? "unknown"; + $.export("$summary", `Contact created: ${name} (ID: ${id}).`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
components/trengo/actions/create-contact/create-contact.mjs(1 hunks)components/trengo/actions/find-contacts/find-contacts.mjs(1 hunks)components/trengo/actions/list-articles/list-articles.mjs(1 hunks)components/trengo/actions/list-tickets/list-tickets.mjs(1 hunks)components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs(1 hunks)components/trengo/actions/send-a-message/send-a-message.mjs(1 hunks)components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs(1 hunks)components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs(1 hunks)components/trengo/sources/new-inbound-message/new-inbound-message.mjs(1 hunks)components/trengo/sources/new-internal-note/new-internal-note.mjs(1 hunks)components/trengo/sources/new-outbound-message/new-outbound-message.mjs(1 hunks)components/trengo/sources/phone-call-ended/phone-call-ended.mjs(1 hunks)components/trengo/sources/phone-call-missed/phone-call-missed.mjs(1 hunks)components/trengo/sources/phone-call-started/phone-call-started.mjs(1 hunks)components/trengo/sources/ticket-label-added/ticket-label-added.mjs(1 hunks)components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- components/trengo/actions/send-a-team-chat-message/send-a-team-chat-message.mjs
🚧 Files skipped from review as they are similar to previous changes (14)
- components/trengo/sources/voice-call-recorded/voice-call-recorded.mjs
- components/trengo/actions/send-a-message/send-a-message.mjs
- components/trengo/sources/new-internal-note/new-internal-note.mjs
- components/trengo/actions/find-contacts/find-contacts.mjs
- components/trengo/actions/list-articles/list-articles.mjs
- components/trengo/actions/send-a-whatsapp-message-template/send-a-whatsapp-message-template.mjs
- components/trengo/actions/log-a-voice-call/log-a-voice-call.mjs
- components/trengo/sources/ticket-label-added/ticket-label-added.mjs
- components/trengo/sources/phone-call-ended/phone-call-ended.mjs
- components/trengo/sources/new-outbound-message/new-outbound-message.mjs
- components/trengo/sources/new-inbound-message/new-inbound-message.mjs
- components/trengo/sources/phone-call-started/phone-call-started.mjs
- components/trengo/actions/list-tickets/list-tickets.mjs
- components/trengo/sources/phone-call-missed/phone-call-missed.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
🔇 Additional comments (2)
components/trengo/actions/create-contact/create-contact.mjs (2)
8-8: Approve code changes
Endpoint documentation link is current and will not 404.
31-39: Remove incorrect duplication warning:channelIdis a separate parameter used bycreateContact, whiledata.channel_idpopulates the request payload—this isn’t redundant.Likely an incorrect or invalid review comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolves #18234
Summary by CodeRabbit